<?php
#echo '<head><style>';
require_once "Common/theme.php";
require_once "Common/values.php";
require_once "Common/database.php";

echo '<P><h3>Links</h3>';
if($_GET[f]=='')
{
$_GET[f]='%';
$_POST[folder]='All';
}

if($_POST[folder]=='All')
{
$_GET[f]='%';
}
if($_POST[folder]=="")
{
$_POST[folder]='All';
}

echo '<form action="index.php?p=lview&f='.$_GET[f].'" method="POST"><table border=1>';
echo '<tr><td><select name="folder" onchange="this.form.submit();"><option>'.$_POST[folder].'</option><option></option>';
genLinks();
echo '</select></td></tr></table></form>';
echo '<table border=1>';
echo '<tr><td>key</td><td>Name</td><td>Folder</td><td>Link</td><td>Delete</td></tr>';
if($_POST[folder]=="All")
{
$_POST[folder]='%';
}
$_GET[f]=$_POST[folder];

$result = mysql_query("SELECT * FROM tblLinks WHERE Folder LIKE '$_GET[f]'");
while($row = mysql_fetch_array($result))
  {
echo '<tr><form action="links/insertu.php" method="POST"><td><input type="hidden" name=key size="3" value="'.$row[Key].'"><input type="text" name=key size="3" value="'.$row[Key].'" disabled ></td><td><input type="text" name="name" value="'.$row[Name].'"></td><td><select name="folder">
<option>'.$row[Folder].'</option>';
genFolder();
echo '</td><td><Input  type="text" size="100" name="link" value=\''.$row[Link].'\'></td><td><input type="checkbox" name="delete" value="checked"></td><td><input type="submit" value="Update"></tr></form>';
  }
echo '<tr><td><a href="index.php?p=ladd">Add</a>';
echo '</table>';
?>